1. Field of the Invention
The present invention relates to a digital image processing method. The invention relates particularly, but not exclusively, to an image processing method of human subjects being photographed by portable image taking devices, particularly of backlit subjects and the following description is made with reference to this field of application for convenience of illustration only.
2. Description of the Related Art
As is well known, one of the main problems limiting photographic image quality involves the generation of sub-optimal photographs due to the wrong exposure to light of the photographed subject.
This problem is particularly suffered in portable devices such as mobile phones, wherein several factors concur in obtaining photographs that are wrongly exposed: the smallness of the available optical device, the lack of a flash device and the like. Moreover, the portable device nature and the traditional use of the photographs produced therefrom, particularly linked to the so-called multimedia messaging services or MMS, cause the acquisition of photographs of the type shown in FIG. 3.
Although it is impossible to provide a precise definition of a correct exposure, since the exposure depends on the photographed subject as well as on the personal taste of the person looking at the photograph, it is however possible to state that, for “normal” subjects (and thus not considering extreme cases, like a snow-covered landscape whose correct acquisition would involve an intentional photograph overexposure), a correct exposure is obtained when the main features of the photographic image are reproduced by using an intermediate grey level.
In the image processing field several techniques for improving the tone quality of photographic images are well known, such as histogram equalization, grey-level slicing, and histogram stretching.
Although advantageous under many aspects, these prior art techniques have several drawbacks mainly linked to the fact of being independent from the visual content of the photographed images.
The article entitled “Automated Global Enhancement of Digitized Photographs” by Bhukhanwale et al., published on the IEEE Transaction on Consumer Electronics, vol. 40, no. 1, 1994, which is hereby incorporated by reference in its entirety, describes instead an algorithm being capable to identify visually important regions in a photographic image, by adjusting the image exposure so that these regions occupy intermediate tone levels.
Moreover, the European patent application no. EP 01830803.1 and assigned U.S. application Ser. No. 10/323,589 filed in the name of STMicroelectronics, the assignee of the present application, which is hereby incorporated by reference in its entirety, describes an algorithm being similarly capable to identify visually important regions in a photographic image in order to replace them at intermediate tone levels. This algorithm directly processes images of the Bayer Pattern type and simplifies the statistical measures used to detect regions in the image having a high information content, i.e., visually important regions.
The algorithms provided in this document directly operate on the image in the Bayer Pattern format and they comprise the following steps:                extraction of the Bayer Pattern green plane or channel G: this plane provides a good approximation of the luminance Y.        
visual analysis: once the channel G has been extracted, the visually interesting regions are identified on this channel. For this purpose, the green plane is split into N blocks having the same size and the following statistical values are calculated for each block:
focus: it characterizes the block sharpness and it is used for identifying the regions comprising high-frequency components, corresponding to details of the photographed image;
contrast: it is related to the image tone range—the higher the contrast, the higher the insulation of the so-called clusters of points in the block, i.e., the higher the block visual impact.
In order to obtain important visual features, independently from the lighting conditions of the photographed image, the visual analysis is performed on an image having an intermediate luminosity produced by making a temporary correction only based on the average value of the channel G calculated on the whole plane. The algorithms further perform exposure adjustment: once the visually interesting regions have been detected, the exposure adjustment is performed by using the average grey levels of these regions as reference values. In greater detail, the photographed image is changed so to bring the average value of these regions to a target value T by changing all the pixels belonging to the Bayer Pattern. This target value T should be a value ranging around 128 and it should take into consideration a possible correction range performed after the color reconstruction of the corrected Bayer Pattern. This means that, in certain cases, the target value T could be substantially lower than 128.
To this aim, a simulated response curve of a digital image taking device or camera is used, schematically shown in FIG. 1.
This curve gives an evaluation of how the light values picked up by the camera are turned into pixel values, i.e., it represents the function:f(q)=I  (1)q being the light amount and I the final pixel value.
This simulated response function (1) of a camera can be expressed in a parametric way:
                              f          ⁡                      (            q            )                          =                  255                                    (                              1                +                                  ⅇ                                      -                                          (                      Aq                      )                                                                                  )                        C                                              (        2        )            
A and C being the control parameters of the curve shape and the value q being expressed in base 2 logarithmic units (also known with the name “stops”. It is possible to evaluate these control parameters A and C by using the information comprised in the article by Mann et al. entitled “Comparametric Equations with Practical Applications in Quantigraphic Image Processing”, IEEE Transactions on Image Processing, Vol. 9, no. 8, 2000, which is hereby incorporated by reference in its entirety.
It is also possible to obtain experimentally the values of these parameters A and C or to set them in order to realize a particular final effect (for example, a more or less marked improvement of the contrast). In particular, FIG. 1 shows the trend of the simulated response curve expressed by the formula (2) with A=7 and C=0.13.
By using this simulated response curve f and an average grey level avg for the visually important regions, the distance Δ of an ideal exposure situation is expressed as:Δ=f−1(128)−f−1(avg)  (3)and the grey value I(x, y) of a pixel with position (x, y) is thus changed in:I′(x,y)=f(f−1(I(x,y))+Δ)  (4)It is worth noting that all the grey values of the pixels are corrected.
In particular, the above-mentioned changes are substantially a look-up table (LUT) transformation (i.e., they can be put in a table in order to be then referred to) and FIGS. 2A and 2B show two different transformations (the curves LUT1 and LUT2) generated from a first simulated response curve f1 with values A=7 and C=0.13 and a second simulated response curve f2 with values A=0.85 and C=1.
It is worth noting that the distance or offset of the value 128 is 1.24 for f1 and 0.62 for f2 respectively (starting from a same input value equal to 72).
From the FIGS. 2A and 2B it is evident that the first curve LUT1 has a more linear trend, while the second curve LUT2 has a so-called range trend.
Although advantageous under several aspects, these prior art techniques are not very effective in the case of portable devices like mobile phones for which the photographic images are often backlit and they are mainly focused on human figures, when the user uses the image transmission for videophony, as shown in FIG. 3.